<script setup lang="ts">
// 子组件定义 prop 即可接收
const props = defineProps<{ msg: string; money: number }>()

// 子组件定义 emit 父组件即可注册对应的事件
const emit = defineEmits<{
  (e: 'changeMoney', money: number): void
  (e: 'changMsg', msg: string): void
}>()
</script>
<template>
  <div class="son">
    <h3>子组件</h3>
    <p @click="$emit('changMsg', msg + '!')">msg:{{ msg }}</p>
    <p @click="$emit('changeMoney', money + 10)">money:{{ money }}</p>
    <button>子组件按钮</button>
  </div>
</template>
<style scoped>
.son {
  border: 1px solid orange;
  background-color: skyblue;
  padding: 20px;
}
</style>
